package zz.app.jmhviewer;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.media.AudioManager;
import android.media.MediaPlayer;

/**
 * Created by zz on 2018/2/8 17:52.
 */

public class AudioNoisyBoardcastReceiver extends BroadcastReceiver {

    OnAudioNoisyListener onAudioNoisyListener;
    AudioNoisyBoardcastReceiver(OnAudioNoisyListener onAudioNoisyListener){
        this.onAudioNoisyListener=onAudioNoisyListener;
    }
    @Override
    public void onReceive(Context context, Intent intent) {
        if(intent!=null&&intent.getAction()!=null) {
            if (intent.getAction().equals(AudioManager.ACTION_AUDIO_BECOMING_NOISY)) {
               if(onAudioNoisyListener!=null)onAudioNoisyListener.onAudioNoisy();
            }
        }
    }
}
